package com.bw.controller;

import com.bw.bean.Vo;
import com.bw.bean.Vo1;
import com.bw.bean.Vo2;
import com.bw.bean.Vo3;
import com.bw.service.VoService;
import com.sugar.SugarUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@RestController
public class VoController {
    @Autowired
    VoService voService;
    @RequestMapping("list1")
    public Map getList(){
        List<Vo> list = voService.getList();
        return SugarUtil.getLineData(list);
    }
    @RequestMapping("list2")
    public Map getList1(){
        List list=new ArrayList();
        list.add("序号");
        list.add("题目内容");
        list.add("答题次数");
        list.add("正确答案");
        list.add("正确率");
        List<Vo1> list1 = voService.getList1();
        return SugarUtil.getTablePlayData(list,list1);
    }
    @RequestMapping ("list3")
    public Map getList2(){
        List list=new ArrayList();
        list.add("序号");
        list.add("试卷名称");
        list.add("考试次数");
        list.add("平均分");
        list.add("平均用时");
        List<Vo2> list2 = voService.getList2();
        return SugarUtil.getTablePlayData(list,list2);
    }
    @RequestMapping("list4")
    public Map getList3(){
        List<Vo3> list3 = voService.getList3();
        return SugarUtil.getBarData(list3);
    }
}
